#include <stdio.h>
#include <stdlib.h>


void arrayLeftRoat(int* arr,int len,int times);

void printArray(int arr[], int length) ;

int main(){
    int N=0;
    scanf("%d",&N);
    int times=0;
    scanf("%d",&times);
    int i;
    int arr[N];
    for (i = 0; i < N; i++) {
        scanf("%d",&arr[i]);
    }
    arrayLeftRoat(arr,N,times%N);
    printArray(arr,N);
    return 0;
}

void arrayLeftRoat(int* arr,int len,int times){
    while (times -- > 0){
        int first=arr[0];
        int i;
        for (i = 0; i < len-1; i++) {
            arr[i] = arr[i+1];
        }
        arr[len-1] = first;
    }
}

void printArray(int arr[], int length){
    int i;
    for (i = 0; i < length; i++) {
        printf("%d", arr[i]);
        if(i != length-1){
            printf(" ");
        }
    }
}
